import { createLogger, createStore, Store } from 'vuex'
import state from './state'
import mutations from './mutations'
import * as actions from './actions'
import * as getters from './gatters'
import { StateProp } from './type'
const dev = process.env.NODE_ENV === 'development'

export default createStore<StateProp>({
  state,
  mutations,
  getters,
  actions,
  strict: dev, // 开发环境下开启严格模式，当开启更新state中的数据时必须使用mutations修改，否则提示警告信息
  plugins: dev ? [createLogger()] : [] // 当修改states数据时，会打印出各个数据的修改前的信息和修改后的信息
})
